﻿namespace TC
{
    public class IfElse_blueprint : TranslateBlueprint
    {
        public override editor.cfg.blueprint.Node OnTranslate(Node node)
        {
            IfElse t = node as IfElse;
            editor.cfg.blueprint.IfElse re = new editor.cfg.blueprint.IfElse();
            re.id = t.id;
            Port p = t.graph.GetConnect(t.flowT);
            if(p != null)
            {
                re.trueNode = p.parent.id;
            }
            p = t.graph.GetConnect(t.flowF);
            if(p != null)
            {
                re.falseNode = p.parent.id;
            }
            p = t.graph.GetConnect(t.condition);
            if(p != null)
            {
                re.condition = new editor.cfg.blueprint.OutputPin() { nodeId = p.parent.id, pinName = p.name };
            }
            return re;
        }
    }
}
